﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once

#include "GnufQtItem.h"
#include "GnufColorControl.h"
#include "GnufQtColorPushButton.h"
#include <QPushButton>
#include <QLabel>
#include <QWidget>

namespace gnuf {
    class QtColorPicker;

    class QtColorControl final : public QtItemWith<QtColorPushButton, ColorControl, QWidget *>
    {
    public:
        explicit QtColorControl(ColorControl*, QWidget * qtParentWidget = nullptr);
        virtual ~QtColorControl() {
            disconnect(this); // no longer be a receiver
        }
        virtual void refresh(QtItem::EWhatDirty) override;
        void onTableRowSelectionChanged(bool);

    protected:
        //wangzg-c 添加代码，用于颜色控件角标绘制，临时添加，后期bnuf可根据需求替换，房琨已代码审查。
        virtual void paintEvent(QPaintEvent *) override;
        virtual void mousePressEvent(QMouseEvent *) override;

    private:
        void onClicked(bool);
        void adjustStyleSheet(bool selected);
        void setStyle();
        void setInfo();
        void connectSignal();
    };
    
}
